﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<CinemaNetwork.Models.Reserv>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	ViewReservation
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>План зала</h2>
    

    <table>
    <tr>
    <td style="height:100px; width:550px; font-size:xx-large">Экран</td>
    </tr>
    </table>

  

    <table  style=" border-width:medium; font-size:medium;color:Black  " >
    
     <%
         foreach (var item in Model)
         {

             if (Session["User"] != null)
             {


                 if (item.place == 1)
                 {
          %><tr> 
           <%
                     if (item.IsSale == 1)
                     {
%>
                               <td onclick="click"  style="background-color: Red; width:100px; height:100px">  <%=  Html.Encode(item.place)%>    </td>
<%    
                     }
                     else
                     {
                         if (item.IsReserved == 1)
                         {  
%>
		<td onclick="click" style="background-color: Green; width:100px; height:100px" ">   <%=  Html.Encode(item.place)%>   </td>
<%   
                         }
                         else
                         {  
%>
		<td onclick="click" style="background-color: White; width:100px; height:100px" "> <%= Html.ActionLink(item.place.ToString(), "AddReserv", "Account", new { place_id = item.place_id, session_id = item.session_id }, null)%>  </td>
<%
                         }
                     }
                              %>
      
           <%
                 }
                 else
                 {
                     if (item.IsSale == 1)
                     {
%>
                               <td onclick="click" style="background-color: Red; width:100px; height:100px" ">  <%=  Html.Encode(item.place)%>  </td>
<%
                     }
                     else
                     {
                         if (item.IsReserved == 1)
                         {
%>
<td onclick="click" style="background-color: Green; width:100px; height:100px" ">  <%=  Html.Encode(item.place)%>  </td>
<%   
                         }
                         else
                         {
%>   
<td  style="background-color: White; width:100px; height:100px" ">     
 <%= Html.ActionLink(item.place.ToString(), "AddReserv", "Account", new { place_id = item.place_id, session_id = item.session_id }, null)%> </td>
<%   
                         }
                     }

                 }
             }

             else {
                 
                 if (item.place == 1)
                 {
          %><tr> 
           <%
                     if (item.IsSale == 1)
                     {
%>
                               <td onclick="click"  style="background-color: Red; width:100px; height:100px">  <%=  Html.Encode(item.place)%>    </td>
<%    
                     }
                     else
                     {
                         if (item.IsReserved == 1)
                         {  
%>
		<td onclick="click" style="background-color: Green; width:100px; height:100px" ">   <%=  Html.Encode(item.place)%>   </td>
<%   
                         }
                         else
                         {  
%>
		<td onclick="click" style="background-color: White; width:100px; height:100px" "> <%=  Html.Encode(item.place)%>  </td>
<%
                         }
                     }
                              %>
      
           <%
                 }
                 else
                 {
                     if (item.IsSale == 1)
                     {
%>
                               <td onclick="click" style="background-color: Red; width:100px; height:100px" ">  <%=  Html.Encode(item.place)%>  </td>
<%
                     }
                     else
                     {
                         if (item.IsReserved == 1)
                         {
%>
<td onclick="click" style="background-color: Green; width:100px; height:100px" ">  <%=  Html.Encode(item.place)%>  </td>
<%   
                         }
                         else
                         {
%>   
<td  style="background-color: White; width:100px; height:100px" ">     
<%=  Html.Encode(item.place)%> </td>
<%   
                         }
                     }

                 }
                  
             }
         }
%>
  
    </table>

    <br />
<%  
    if (Session["User"] != null)
    {
            %> Чтобы забронировать место, просто щелкните по ссылке!
            <% }%>
            <%else
    {
        if (Session["Admin"] != null)
        {
         %>Вы админ, вам не к чему бронировать места =)<%   
        }
        else
        {
        %>Авторизуйтесь и бронируйте!  <% }
    } %> 
    <table style="color:Black">
    <tr>
    <td style="height:10px; width:20px; background-color:Red"></td>
    <td>Место куплено</td>
    </tr>
        <tr>
    <td style="height:10px; width:20px; background-color:Green"></td>
    <td>Место забронировано</td>
    </tr>
        <tr>
    <td style="height:10px; width:20px; background-color:White"></td>
    <td>Место свободно</td>
    </tr>
    </table>


    


</asp:Content>

